<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Array Where</title>
    <script src="arrayExtend.js" type="text/javascript"></script>
    <!--<script src="arrayExtend.js" type="text/javascript"></script>-->
    <script>
    var qut=48;
    var arr=[{"Id":0,"OutStorageNo":"OS201905171151447414","ProductId":2794,"Quantity":2496,"Price":5.0,"ConfirmedQuantity":0,"OccupyStock":0,"TransportStock":null,"Remark":"","IsSelected":false,"bar_code":null,"brand_name":null,"market_price":null,"pro_name":null,"pro_code":null,"standard":null},{"Id":0,"OutStorageNo":"OS201905171151447414","ProductId":2799,"Quantity":408,"Price":0.0,"ConfirmedQuantity":0,"OccupyStock":0,"TransportStock":null,"Remark":"","IsSelected":false,"bar_code":null,"brand_name":null,"market_price":null,"pro_name":null,"pro_code":null,"standard":null},{"Id":0,"OutStorageNo":"OS201905171151447414","ProductId":2800,"Quantity":407,"Price":0.0,"ConfirmedQuantity":0,"OccupyStock":0,"TransportStock":null,"Remark":"","IsSelected":false,"bar_code":null,"brand_name":null,"market_price":null,"pro_name":null,"pro_code":null,"standard":null},{"Id":0,"OutStorageNo":"OS201905171151447414","ProductId":2803,"Quantity":48,"Price":0.0,"ConfirmedQuantity":0,"OccupyStock":0,"TransportStock":null,"Remark":"","IsSelected":false,"bar_code":null,"brand_name":null,"market_price":null,"pro_name":null,"pro_code":null,"standard":null},{"Id":0,"OutStorageNo":"OS201905171151447414","ProductId":2804,"Quantity":48,"Price":0.0,"ConfirmedQuantity":0,"OccupyStock":0,"TransportStock":null,"Remark":"","IsSelected":false,"bar_code":null,"brand_name":null,"market_price":null,"pro_name":null,"pro_code":null,"standard":null},{"Id":0,"OutStorageNo":"OS201905171151447414","ProductId":2808,"Quantity":600,"Price":0.0,"ConfirmedQuantity":0,"OccupyStock":0,"TransportStock":null,"Remark":"","IsSelected":false,"bar_code":null,"brand_name":null,"market_price":null,"pro_name":null,"pro_code":null,"standard":null},{"Id":0,"OutStorageNo":"OS201905171151447414","ProductId":2809,"Quantity":96,"Price":0.0,"ConfirmedQuantity":0,"OccupyStock":0,"TransportStock":null,"Remark":"","IsSelected":false,"bar_code":null,"brand_name":null,"market_price":null,"pro_name":null,"pro_code":null,"standard":null},{"Id":0,"OutStorageNo":"OS201905171151447414","ProductId":2810,"Quantity":600,"Price":0.0,"ConfirmedQuantity":0,"OccupyStock":0,"TransportStock":null,"Remark":"","IsSelected":false,"bar_code":null,"brand_name":null,"market_price":null,"pro_name":null,"pro_code":null,"standard":null},{"Id":0,"OutStorageNo":"OS201905171151447414","ProductId":2836,"Quantity":24000,"Price":0.0,"ConfirmedQuantity":0,"OccupyStock":0,"TransportStock":null,"Remark":"","IsSelected":false,"bar_code":null,"brand_name":null,"market_price":null,"pro_name":null,"pro_code":null,"standard":null},{"Id":0,"OutStorageNo":"OS201905171151447414","ProductId":2839,"Quantity":43463,"Price":0.0,"ConfirmedQuantity":0,"OccupyStock":0,"TransportStock":null,"Remark":"","IsSelected":false,"bar_code":null,"brand_name":null,"market_price":null,"pro_name":null,"pro_code":null,"standard":null},{"Id":0,"OutStorageNo":"OS201905171151447414","ProductId":2840,"Quantity":360,"Price":0.0,"ConfirmedQuantity":0,"OccupyStock":0,"TransportStock":null,"Remark":"","IsSelected":false,"bar_code":null,"brand_name":null,"market_price":null,"pro_name":null,"pro_code":null,"standard":null},{"Id":0,"OutStorageNo":"OS201905171151447414","ProductId":2841,"Quantity":359,"Price":0.0,"ConfirmedQuantity":0,"OccupyStock":0,"TransportStock":null,"Remark":"","IsSelected":false,"bar_code":null,"brand_name":null,"market_price":null,"pro_name":null,"pro_code":null,"standard":null}]
    console.log('原始数据')
    console.log(arr)
    console.log(arr.where('x=>x.Quantity==48'))
    console.log(arr.whereFun(function(val){
        return val.Quantity>this.qut;
    }))
    console.log(arr.select('x=>new {proId:x.ProductId,qut:x.Quantity,ac:{Price:x.Price,Remark:x.Remark},total:x.Quantity*x.Price}'))
    console.log(arr.selectFun(function(val){return val.ProductId;}))
    console.log(arr.selectFun(function(x){return {proId:x.ProductId,qut:x.Quantity,ac:{Price:x.Price,Remark:x.Remark},total:x.Quantity*x.Price};}))
    console.log(arr.where('x=>x.Price>0').sum('x=>x.Quantity*x.Price'))
    console.log(arr.sumFun(function(x){return x.Quantity;}))
    console.log(arr.distinct('x=>x.Quantity'))
    console.log(arr.distinctFun('Quantity'))
    console.log(arr.toJsonStr())
    console.log(arr.joins('x=>x.ProductId'))
    console.log(arr.joinsFun('ProductId'))
    console.log(arr.selectFun(function(val){return val.ProductId;}).toJoinStr())
    </script>
</head>
<body>
    
</body>
</html>